import { apiService } from './api'
import { API_ENDPOINTS } from '@/config/api'

// 升级记录接口
export interface UpgradeRecord {
  id: string
  sn: string
  product_id: string
  version: string
  upgrade_time: string
  status: string // success, failed, in_progress
  message: string
  created_at: string
  updated_at: string
  product: {
    id: string
    name: string
    public_id: string
  }
}

// 升级记录服务
export const upgradeService = {
  // 获取升级记录列表
  getUpgradeRecords: (productId?: string, sn?: string): Promise<UpgradeRecord[]> => {
    const params: any = {}
    if (productId) params.product_id = productId
    if (sn) params.sn = sn
    return apiService.get<UpgradeRecord[]>(API_ENDPOINTS.UPGRADE_RECORDS, params)
  }
} 